<?php
include('Common_func.php');
$curtime = time();
error_reporting(E_ALL);ini_set('display_errors',1);
date_default_timezone_set('Asia/Shanghai');//'Asia/Shanghai'   亚洲/上海


#查询今日外放的渠道
$today_channel = "select * from date_records where status = 1";
$res = $dbh->prepare($today_channel);
$res->execute();
$date_infos = $res->fetchAll(PDO::FETCH_ASSOC);
$channel_str = '';
foreach ($date_infos as $date){
    if($date['expired_at'] <= $curtime){ //约会过期了
        $update = array(
            'status' => 2
        );
        $where = ' id = ' . $date['id'];
        updateData($dbh, 'date_records', $update, $where);

        $where = ' date_id = ' . $date['id'];
        updateData($dbh, 'appointment', $update, $where);

    }
}

